﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UpdateProduct.aspx.cs"
    Inherits="ShowroomMobile.UpdateProduct" Title="Update Product" MasterPageFile="~/AdminSite.Master"
    Theme="tbmobile" %>

<%@ Register Assembly="FreeTextBox" Namespace="FreeTextBoxControls" TagPrefix="FTB" %>
<asp:Content runat="server" ID="cUpdateProduct" ContentPlaceHolderID="body">
    <script type="text/javascript" src="scripts/ui.dropdownchecklist.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#<%= lstCategory.ClientID %>").dropdownchecklist({ emptyText: "Please select ...", width: 350 }); 

            $(".checkProductImage input[type=radio]").live("change", function () {
                $(".checkProductImage input[type=radio]").attr("checked", false);
                $(this).attr("checked", true);
                var hidImageDefaultID = document.getElementById('<%= hidImageDefaultID.ClientID %>');
                hidImageDefaultID.value = $(this).attr("value");
            });
            $(".buttonDeleteProductImage").live("click", function () {
                var value = $(this).attr("value");
                $("#img" + value).remove();
                var hidDeleteImageID = document.getElementById('<%= hidDeleteImageID.ClientID %>');
                hidDeleteImageID.value += value + ",";
            });
        });
    </script>
    <table cellpadding="5" cellspacing="0">
        <tr>
            <td>
                Product Name
                <label class='required'>
                    *</label>
            </td>
            <td>
                <asp:TextBox ID="txtProductName" runat="server" class="admin_txt" ValidationGroup="Save"
                    Width="250px" />
                <asp:RequiredFieldValidator ValidationGroup="Save" ID="RequiredFieldValidator3" runat="server"
                    class='requiredField' ErrorMessage="" Text='' Display="Dynamic" ControlToValidate="txtProductName"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td>
                Category(s)
            </td>
            <td>
                <asp:ListBox SelectionMode="Multiple" ID="lstCategory" runat="server"></asp:ListBox>
            </td>
        </tr>
        <tr>
            <td>Price</td>
            <td><asp:TextBox runat="server" ID="txtPrice" Text="" CssClass="number" /></td>
        </tr>
        <tr>
            <td valign="top">
                Image(s)
                <label class='required'>
                    *</label>
            </td>
            <td>
                <asp:FileUpload ID="FileUpload1" runat="server" class="multi" />
            </td>
        </tr>
        <tr>
            <td>
            </td>
            <td>
                <asp:UpdatePanel runat="server" ID="upProductImages" UpdateMode="Conditional">
                    <ContentTemplate>
                        <asp:Repeater runat="server" ID="rptImages" OnItemCommand="rptImages_ItemCommand">
                            <HeaderTemplate>
                                <ul class="listImageAdmin">
                            </HeaderTemplate>
                            <ItemTemplate>
                                <li id='img<%# Eval("ID") %>'>
                                    <div class="imgBorder"><span></span>
                                        <img class="imgAdmin" src='<%# ShowroomMobile.Utilities.GetKeySetting("PathUploadImageThumb") + "/" + Eval("OriginalUrl") %>' /></div>
                                    <div>
                                        <img src="~/images/delete.png" runat="server" value='<%# Eval("ID") %>' class="buttonDeleteProductImage" style="cursor:pointer" alt="Delete This Image" title="Delete This Image"/>
                                        <asp:RadioButton runat="server" ID="rbSetDefault" checked='<%# Eval("Default") %>' class="checkProductImage" value='<%# Eval("ID") %>' Text="Set Default" />
                                    </div>
                                </li>
                            </ItemTemplate>
                            <FooterTemplate>
                                </ul>
                            </FooterTemplate>
                        </asp:Repeater>
                    </ContentTemplate>
                </asp:UpdatePanel>
                <asp:HiddenField runat="server" ID="hidDeleteImageID" /><asp:HiddenField runat="server" ID="hidImageDefaultID" />
            </td>
        </tr>
        <tr>
            <td style="vertical-align: top;">
                Description
            </td>
            <td>
                <FTB:FreeTextBox ID="ftbDescription" runat="server" Width="650px">
                </FTB:FreeTextBox>
            </td>
        </tr>
        <tr>
            <td>
            </td>
            <td>
                <asp:Button runat="server" ID="btnSave" ValidationGroup="Save" OnClick="btnSave_OnClick"
                    Text="Save" />&nbsp;<asp:Button runat="server" ID="btnCancel" OnClick="btnCancel_OnClick"
                    Text="Cancel" />
                <br />
                <br />
                <label class='required'>
                    *</label>
                required
            </td>
        </tr>
    </table>
</asp:Content>
